import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/user',
    component: () => import('views/Login/index.vue'),
    redirect: '/login',
    children: [
      {
        path: '/login',
        component: () => import('views/Login/Login.vue'),
      },
      {
        path: '/register',
        component: () => import('views/Login/Register.vue'),
      },
    ]
  },
  {
    path: '/main-content',
    component: () => import('views/Home/index.vue'),
    redirect: '/home',
    children: [
      {
        path: '/home',
        component: () => import('views/Home/Home.vue')
      },
      {
        path: '/search',
        component: () => import('views/Search/Search.vue')
      },
      {
        path: '/order',
        component: () => import('views/Order/Order.vue')
      },
      {
        path: '/profile',
        component: () => import('views/Profile/Profile.vue')
      }
    ]
  },
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
